package com.happe.foodeasy.winter.typemap;

import com.happe.foodeasy.winter.conf.parser.DatabaseTypeMapParseResult;

import java.lang.reflect.Field;

/**
 * This class is the superclass of type mapping, the subclass can
 * extend this class to support different type mapping from java type
 * to database type.
 * Created by wubin on 2016-05-20.
 */
abstract class TypeMapDeal {
    private DatabaseTypeMapParseResult databaseTypeParseResult;

    @SuppressWarnings("all")//will invoke in ParseTypeMap class with reflection.
    public abstract String retrieveMapType(Field field);

    /**
     * used to set DatabaseTypeParseResult instance,
     * this instance is used to get corresponding database type result.
     *
     * @param databaseTypeParseResult the instance of DatabaseTypeParseResult
     */
    @SuppressWarnings("all")//will invoke in ParseTypeMap class with reflection.
    public void setDatabaseTypeParseResult(DatabaseTypeMapParseResult databaseTypeParseResult) {
        this.databaseTypeParseResult = databaseTypeParseResult;
    }

    DatabaseTypeMapParseResult getDatabaseTypeMapParseResult() {
        return databaseTypeParseResult;
    }
}
